import sys

from PySide6.QtWidgets import QApplication, QMessageBox, QSystemTrayIcon

from window import Window

# The System Tray Icon example shows how to add an icon with a menu and popup messages to a desktop environment’s system tray.
# https://doc.qt.io/qtforpython-6/examples/example_widgets_desktop_systray.html#example-widgets-desktop-systray

if __name__ == "__main__":
    app = QApplication()

    if not QSystemTrayIcon.isSystemTrayAvailable():
        QMessageBox.critical(None, "Systray", "I couldn't detect any system tray on this system.")
        sys.exit(1)

    QApplication.setQuitOnLastWindowClosed(False)

    window = Window()
    window.show()
    sys.exit(app.exec())
